CREATE TABLE [finance].[Journal]
(
[JournalId] [bigint] NOT NULL IDENTITY(10000, 1),
[CustomerId] [bigint] NOT NULL,
[PostedDate] [datetime] NOT NULL,
[TxnAmount] [money] NOT NULL,
[TxnId] [bigint] NULL,
[TxnSourceId] [bigint] NULL,
[ReversalDate] [datetime] NULL,
[RevJEId] [bigint] NULL,
[TxnTypeId] [int] NULL,
[TxnType] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Comments] [nvarchar] (4000) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[YYYYMM] [int] NOT NULL,
[IntPostedDate] AS ((datepart(year,[PostedDate])*(100)+datepart(month,[PostedDate]))*(100)+datepart(day,[PostedDate])),
[UpdateUser] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[UpdatedDate] [datetime] NOT NULL CONSTRAINT [CT_Journal_UpdatedDate] DEFAULT (getdate())
) ON [PRIMARY]
GO
ALTER TABLE [finance].[Journal] ADD CONSTRAINT [PK__Journal__250103E64589517F] PRIMARY KEY CLUSTERED  ([JournalId]) ON [PRIMARY]
GO
